;;;;;;;;;;;;;;;;;;;;  w3m browser  ;;;;;;;;;;;;;;;;;;;;
(require 'w3m)
(setq w3m-use-mule-ucs t)
(setq w3m-use-toolbar t)
(setq w3m-use-cookies t)
(setq w3m-display-inline-image t)
(setq w3m-tab-width 8)
(setq w3m-view-this-url-new-session-in-background t)
(setq w3m-home-page emax-w3m-home)
(defun rand-w3m-view-this-url-background-session ()
  (interactive)
  (let ((in-background-state w3m-new-session-in-background))
    (setq w3m-new-session-in-background t)
    (w3m-view-this-url-new-session)
    (setq w3m-new-session-in-background in-background-state)))
(defun my-w3m-bindings ()
  (define-key w3m-mode-map (kbd "C-<return>") 'rand-w3m-view-this-url-background-session))
(add-hook 'w3m-mode-hook 'my-w3m-bindings)
(setq w3m-display-inline-image t)
(setq browse-url-browser-function (quote browse-url-text-emacs))
(setq browse-url-firefox-program "firefox")
(setq browse-url-text-browser "w3m")
(setq mm-text-html-renderer 'w3m)
(setq mm-inline-text-html-with-images t)
(setq mm-inline-text-html-renderer 'mm-inline-text-html-render-with-w3m)
(setq mm-inline-text-html-with-images "")

;;;;;;;;;;;;;;;;;;;;  lftp  ;;;;;;;;;;;;;;;;;;;;
(require 'shell-completion)
(add-to-list 'shell-completion-options-alist
            '("lftp" emax-lftp-sites))
(defvar  emax-lftp-sites (shell-completion-get-file-column emax-lftp-bookmarks 0 "[ \t]+"))
(add-to-list 'shell-completion-prog-cmdopt-alist
            '("lftp" ("help" "open" "get" "mirror") ("open" my-lftp-sites)))

;;;;;;;;;;;;;;;;;;;;  ibuffer  ;;;;;;;;;;;;;;;;;;;;
(setq ibuffer-deletion-face (quote font-lock-string-face))
(setq ibuffer-expert t)
(setq ibuffer-filter-group-name-face (quote font-lock-warning-face))
(setq ibuffer-use-other-window nil)
(setq initial-scratch-message ";;;come on")

;;;;;;;;;;;;;;;;;;;;  printer  ;;;;;;;;;;;;;;;;;;;;
(setq lpr-command "lpr")
(setq lpr-switches (quote ("-o page-top=40 -o page-bottom=40 -o page-left=70 -o page-right=70")))
(setq printer-name "CUPS-PDF")

;;;;;;;;;;;;;;;;;;;;  ecb  ;;;;;;;;;;;;;;;;;;;;
(setq ecb-auto-activate nil)
(setq ecb-eshell-auto-activate nil)
(setq ecb-eshell-enlarge-when-eshell nil)
(setq ecb-layout-name "left8")
(setq ecb-layout-window-sizes (quote (("zleinter1" (0.16535433070866143 . 0.25) (0.16535433070866143 . 0.175) (0.16535433070866143 . 0.175) (0.16535433070866143 . 0.2) (0.16535433070866143 . 0.175)) ("zleinter" (0.1889763779527559 . 0.15) (0.1889763779527559 . 0.15) (0.1889763779527559 . 0.175) (0.1889763779527559 . 0.2) (0.1889763779527559 . 0.15) (0.1889763779527559 . 0.15)) ("left8" (0.1732283464566929 . 0.275) (0.1732283464566929 . 0.225) (0.1732283464566929 . 0.3) (0.1732283464566929 . 0.175) (0.47244094488188976 . 0.175) (0.36220472440944884 . 0.175)))))
(setq ecb-options-version "2.32")
(setq ecb-redraw-layout-quickly t)
(setq ecb-select-edit-window-on-redraw t)
(setq ecb-split-edit-window-after-start nil)
(setq ecb-tip-of-the-day nil)
(setq ecb-use-recursive-edit t)

;;;;;;;;;;;;;;;;;;;;  twitter setting  ;;;;;;;;;;;;;;;;;;;;
(require 'twittering-mode)
(setq twittering-use-master-password t)
(setq twittering-allow-insecure-server-cert t)
(setq twittering-oauth-use-ssl nil)
(setq twittering-use-ssl nil)
(twittering-enable-unread-status-notifier)
(setq-default twittering-icon-mode t)
(setq twittering-initial-timeline-spec-string '(":home@sina"
                                        ; “:home@douban”
                                                ))

;;;;;;;;;;;;;;;;;;;;  eshell  ;;;;;;;;;;;;;;;;;;;;
(setq eshell-cp-interactive-query t
      eshell-ln-interactive-query t
      eshell-mv-interactive-query t
      eshell-rm-interactive-query t
      eshell-mv-overwrite-files nil)
(setq eshell-banner-message "hello, dimilar\n")
(setq eshell-cd-on-directory t)
(setq eshell-cd-shows-directory t)
(setq eshell-cmpl-cycle-completions nil)
(setq eshell-cmpl-expand-before-complete t)
(setq eshell-cmpl-ignore-case t)
(setq eshell-debug-command t)
(setq eshell-list-files-after-cd nil)
(setq eshell-output-filter-functions (quote (eshell-handle-control-codes eshell-watch-for-password-prompt eshell-postoutput-scroll-to-bottom)))
(setq eshell-plain-echo-behavior t)
(setq eshell-prefer-lisp-functions t)
(setq eshell-scroll-show-maximum-output t)
(setq eshell-scroll-to-bottom-on-output nil)
(setq eshell-show-lisp-completions t)

;;;;;;;;;;;;;;;;;;;;  tramp   ;;;;;;;;;;;;;;;;;;;;
(setq tramp-default-method "ssh")
(add-to-list 'tramp-default-method-alist
             '("\\`localhost\\'" "\\`root\\'" "su"))
(setq tramp-default-user "root"
      tramp-default-host "localhost")
(setq tramp-verbose 10)
(setq tramp-shell-prompt-pattern "^[^$>\n]*[#$%>] *\\([[0-9;]*[a-zA-Z] *\\)*")
;;(setq require-final-newline nil)
;; (setq tramp-debug-buffer t)
;;(setq shell-prompt-pattern "")
;;(setq tramp-shell-prompt-pattern "^[^$>\n]*[#$%>] *\\(\[[0-9;]*[a-zA-Z] *\\)*")


;;;;;;;;;;;;;;;;;;;;  google  ;;;;;;;;;;;;;;;;;;;;
;; (require 'google-maps)
;; (require 'google-weather)
;; (cfw:open-ical-calendar "http://www.google.com/calendar/ical/schuleichu%40gmail.com/public/basic.ics")(require 'org-google-weather)

;;;;;;;;;;;;;;;;;;;;  babel  ;;;;;;;;;;;;;;;;;;;;
(require 'babel)
(autoload 'babel "babel"
  "Use a web translation service to translate the message MSG." t)
(autoload 'babel-region "babel"
  "Use a web translation service to translate the current region." t)
(autoload 'babel-as-string "babel"
  "Use a web translation service to translate MSG, returning a string." t)
(autoload 'babel-buffer "babel"
  "Use a web translation service to translate the current buffer." t)

;;;;;;;;;;;;;;;;;;;;  spell check  ;;;;;;;;;;;;;;;;;;;;
(setq ispell-personal-dictionary emax-personaldic-en)
(if (file-exists-p "/usr/bin/hunspell")
    (progn
      (if (file-exists-p "/usr/share/hunspell")
          (setq spell-suffix "hunspell")
        (setq spell-suffix "myspell"))
      (setq ispell-program-name "hunspell")
      (require 'rw-language-and-country-codes)
      (require 'rw-ispell)
      (require 'rw-hunspell)
      (let ((dict-name (concat "en_US_" spell-suffix))
            (dict-folder (concat "/usr/share/" spell-suffix)))
        (setq ispell-dictionary dict-name)
        ;; The following is set via custom
        (custom-set-variables
         '(rw-hunspell-default-dictionary dict-name)
         '(rw-hunspell-dicpath-list (list dict-folder))
         '(rw-hunspell-make-dictionary-menu t)
         '(rw-hunspell-use-rw-ispell t))))
  (eval-after-load "ispell"
        '(progn
           (setq ispell-dictionary "american")
           (setq flyspell-default-dictionary "american")
           (setq ispell-local-dictionary "american"))))

;;;;;;;;;;;;;;;;;;;;  sdcv setting  ;;;;;;;;;;;;;;;;;;;;
(require 'sdcv)
(setq sdcv-dictionary-simple-list        ;; a simple dictionary list
      '(
        "CDICT5英汉辞典"
        "新世纪英汉科技大词典"
        "朗道英汉字典5.0"
        "德汉词典"
        "新世纪汉英科技大词典"
        "Fundset德汉词典"
        "汉德辞典"
        "计算机词汇"
        "朗道汉英字典5.0"
        "21世纪英汉汉英双向词典"        ))
(setq sdcv-dictionary-complete-list      ;; a complete dictionary list
      '("CDICT5英汉辞典"
        "新世纪英汉科技大词典"
        "朗道英汉字典5.0"
        "德汉词典"
        "新世纪汉英科技大词典"
        "Webster's Revised Unabridged Dictionary (1913)"
        "Fundset德汉词典"
        "汉德辞典"
        "计算机词汇"
        "朗道汉英字典5.0"
        "21世纪英汉汉英双向词典"
        "Longman Dictionary of Contemporary English"
        "quick_eng-zh_CN"
        "WordNet"))

